//day 1-1 数字统计
import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner in=new Scanner(System.in);
        int l=in.nextInt();
        int r=in.nextInt();
        int sum=0;
        for (int i = l; i <=r ; i++) {
            int temp=i;
            while (temp!=0){
                if(temp%10==2){
                    sum++;
                }
                temp/=10;
            }
        }
        System.out.println(sum);
    }
}
